---
title: "SQL-009: Max premium history set ID"
summary: Retrieve maximum premium-history set ID
status: draft
owner: SAIF Claims BOF team
last_reviewed: 2026-08-21
library: SAIF.Business.Policy
reference_type: embedded
---

# SQL-009 Max premium history set ID

Retrieves the maximum premium-history set ID from `PREM_HIST_SUMMARY` for a policy number and period effective date, filtered to premium-history type codes `1` or `3`, consumed by `PolicyInformation.MaxPremiumHistorySetId`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-009 |
| **Operation type** | Read |
| **Execution method** | Inline SQL, VB `& _` string-concatenation |
| **Database** | Oracle |
| **Schema** | `[unqualified]**` |
| **Command type** | Text |
| **Business object** | N/A (Application layer) |
| **Criteria property** | N/A |
| **Lifecycle method** | N/A |
| **Application class** | `PolicyInformation` (property `MaxPremiumHistorySetId`, Get) |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:PolicyNumber` | Input | Decimal (`inPolicyNumber`) | N/A | Policy number filter on `PREM_HIST_SUMMARY`. |
| `:PolicyPeriodEffectiveDate` | Input | Date (`inPolicyPeriodEffectiveDate`) | N/A | Policy-period effective date filter on `PREM_HIST_SUMMARY`. |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [PREM_HIST_SUMMARY](../database-tables.md#prem_hist_summary) | SELECT | `PREM_HIST_SET_ID`, `POLICY_NUM`, `POLICY_PERIOD_EFF_DATE`, `PREM_HIST_TYPE_CODE` |

## Sample SQL

```sql
select max(prem_hist_set_id)
from prem_hist_summary phs
where phs.policy_num = :PolicyNumber
  and phs.policy_period_eff_date = :PolicyPeriodEffectiveDate
  and phs.prem_hist_type_code in ('1','3')
```

## Operations and processes
- [Determine maximum premium-history set ID](../operations/determine-maximum-premium-history-set-id.md)

## Sources
- `SAIF.Business.Policy\PolicyInformation.vb`
